<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"
	contentType="text/html; charset=UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="pg" uri="http://jsptags.com/tags/navigation/pager"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>合众人寿公益平台客户管理系统</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

		<link href="<%=request.getContextPath()%>/html/css/Main.css"
			rel="stylesheet" type="text/css" />
	    <script src="<%=request.getContextPath()%>/html/js/Calendar.js"
			charset="utf-8"></script>
		  <!-- Dwr Js -->
		<script
			src="<%= request.getContextPath() %>/dwr/interface/organizationAction.js"
			type="text/javascript"></script>
		<script src="<%= request.getContextPath() %>/dwr/engine.js"
			type="text/javascript"></script>
		<script src="<%= request.getContextPath() %>/dwr/util.js"
			type="text/javascript"></script>
		<script src="<%= request.getContextPath() %>/html/js/subCityUtil.js"
			type="text/javascript"></script>
	 
			
			<style>
body,ul,ol,dl,dd,p,h1,h2,h3,h4,h5,h6,form,input,textarea,select,td,th{margin:0;padding:0; font-family:"宋体",Arial, Helvetica, sans-serif;}
li{ list-style:none;}
input{ background:none;}
.clear{ zoom:1;}
.clear:after{content:""; display:block; clear:both;}
.add span{width:120;}
td input{
width:174px;
}
</style>
	    
	    
		<SCRIPT type="text/javascript">
		
     function check(){
     	if(document.getElementById("activityDate").value == ''){
     	   alert("请输入活动日期!");
     	   return false;
     	}
     	if(leftTrim(document.getElementById("school").value) == ''){
     	   alert("请输入学校!");
     	   return false;
     	}
     	if(leftTrim(document.getElementById("donateMoney").value) == ''){
     	   alert("请输入捐助金额!");
     	   return false;
     	} 
     	if(document.getElementById("donateMoney").value < 0 || isNaN(document.getElementById("donateMoney").value)){
     	   alert("捐助金额不合法!");
     	   return false;
     	} 
     	if(document.getElementById("selfDrivings").value == ''){
     	   alert("请输入自驾车辆数!");
     	   return false;
     	} 
     	if(document.getElementById("selfDrivings").value.search(/^\d+$/)== -1){
     	   alert("自驾车辆数不合法!");
     	   return false;
     	} 
     	if(document.getElementById("subCompany").value == ''){
     	   alert("请选择分公司!");
     	   return false;
     	} 
     	if(document.getElementById("subCity").value == ''){
     	   alert("请选择中支机构!");
     	   return false;
     	} 
     	if(leftTrim(document.getElementById("activityFee").value) == ''){
     	   document.getElementById("activityFee").value = 0;
     	}else{
	     	if(document.getElementById("activityFee").value < 0 || isNaN(document.getElementById("activityFee").value)){
	     	   alert("活动经费不合法!");
	     	   return false;
     		} 
     	}
     	if(leftTrim(document.getElementById("oaSph").value) == ''){
     		alert("请输入OA审批号!");
	     	return false;
     	}
     	document.getElementById("subComName").value = document.getElementById("subCompany").options[document.getElementById("subCompany").selectedIndex].innerText;
     	document.getElementById("subCityName").value = document.getElementById("subCity").options[document.getElementById("subCity").selectedIndex].innerText;
     	return true;
     }
     
     
     function ajaxSubmitCom(){
     
	     ajaxSubmit();
	     document.getElementById("subCity").options[0].innerText = "请选择中支机构";
     }
     
      function   leftTrim(ui){  
	    var   notValid=/^\s/;  
	    while(notValid.test(ui)){  
	      ui=ui.replace(notValid,"");}  
       return   ui; 
       }  
     
     
	 </SCRIPT>
	</head>
	<body>
		<div class="container">
			<div class="wrap clear">
				<div class="sub_wp_right">
					<div class="rt_tt">
						<h3 class="tittle">
							修改爱心之旅活动
						</h3>
					</div>
					<div class="ct">
						<form
							action="<%=request.getContextPath()%>/journeyLove/updatedJourneyLove.do"
							method="post" onsubmit="return check()">
							<div class="add">
								<table  class="viewTable">
								  <tr>
									<td align="right" class="title">
										<span>活动日期<font color="red">(*)</font>：</span>
									</td>
									<td class="t2" >
										<input type="text" name="journeyLove.activityDate"
											id="activityDate" value="${journeyLove.activityDate}" onfocus="calendar()" />
									</td>
									<td align="right" class="title">
										<span>学校<font color="red">(*)</font>：</span>
									</td>
									<td class="t2">
										<input type="text" name="journeyLove.school" id="school"
											value="${journeyLove.school}" />
									</td>
								</tr>
								<tr>
									
									<td align="right" class="title">
										<span>捐助金额<font color="red">(*)</font>：</span>
									</td>
									<td class="t2">
										<input type="text" name="journeyLove.donateMoney"
											id="donateMoney" value="${journeyLove.donateMoney}" />
									</td>
									<td align="right" class="title">
										<span>自驾车辆数<font color="red">(*)</font>：</span>
									</td>
									<td class="t2">
										<input type="text" name="journeyLove.selfDrivings"
											id="selfDrivings" value="${journeyLove.selfDrivings}" />
									</td>
								</tr>
								
								<!-- 
								<tr>
									<td align="right">
										<span>绿卡会员人数<font color="red">(*)</font>：</span>
									</td>
									<td class="t2">
										<input type="text" name="journeyLove.greenCardMember"
											id="greenCardMember" value="${journeyLove.greenCardMember}" />
									</td>
									<td align="right">
										<span>银卡会员人数<font color="red">(*)</font>：</span>
									</td>
									<td class="t2">
										<input type="text" name="journeyLove.silverCardMember"
											id="silverCardMember" value="${journeyLove.silverCardMember}" />
									</td>
								</tr>
								<tr>
									<td align="right">
										<span>金卡会员人数<font color="red">(*)</font>：</span>
									</td>
									<td class="t2">
										<input type="text" name="journeyLove.goldenCardMember"
											id="goldenCardMember" value="${journeyLove.goldenCardMember}" />
									</td>
									<td align="right">
										<span>金箔卡会员人数<font color="red">(*)</font>：</span>
									</td>
									<td class="t2">
										<input type="text" name="journeyLove.platinumCardMember"
											id="platinumCardMember"
											value="${journeyLove.platinumCardMember}" />
									</td>
								</tr>
								<tr>
									<td align="right">
										<span>钻石卡会员人数<font color="red">(*)</font>：</span>
									</td>
									<td class="t2">
										<input type="text" name="journeyLove.diamondCardMember"
											id="diamondCardMember"
											value="${journeyLove.diamondCardMember}" />
									</td>
									
									<td align="right">
										<span>捐助学生人数<font color="red">(*)</font>：</span>
									</td>
									<td class="t2">
										<input type="text" name="journeyLove.donateStuNum"
											id="donateStuNum" value="${journeyLove.donateStuNum}" />
									</td>
								</tr>
								 -->
								<tr>
									<td align="right" class="title">
										<span>分公司<font color="red">(*)</font>：</span>
									</td>
									<td class="t2" >
										<select name="journeyLove.subCompany" id="subCompany" style="width:174px;"  onchange="ajaxSubmitCom()" >
											<s:iterator value="#session.barchList" var="organ">
												<option value="<s:property value="#organ.um_organ_id" />"
													<c:if test="${journeyLove.subCompany eq organ.um_organ_id }">selected</c:if>>
													<s:property value="#organ.abbr_name" />
												</option>
											</s:iterator>
										</select>
									</td>
									
									<td align="right" class="title">
										<span>中支<font color="red">(*)</font>：</span>
									</td>
									<td class="t2" >
									  <c:if test="${'THIRDADMIN' eq rolename}">
										<select name="journeyLove.subCity" id="subCity" style="width:174px;">
											<s:iterator value="#session.expensedList" var="organ">
												<option value="<s:property value="#organ.um_organ_id" />"
													<c:if test="${journeyLove.subCity eq organ.um_organ_id }">selected</c:if>>
													<s:property value="#organ.abbr_name" />
												</option>
											</s:iterator>
										</select>
										</c:if>
										<c:if test="${'THIRDADMIN' ne rolename}">
										<select name="journeyLove.subCity" id="subCity" style="width:174px;">
											<s:iterator value="#request.expensedCityList" var="organ">
												<option value="<s:property value="#organ.um_organ_id" />"
													<c:if test="${journeyLove.subCity eq organ.um_organ_id }">selected</c:if>>
													<s:property value="#organ.abbr_name" />
												</option>
											</s:iterator>
										</select>
										</c:if>
										
										<input type="hidden" value="${subCityHidden}" name="subCityHidden" id="subCityHidden"/>
									</td>
                              </tr>
                              <tr>
                                    <td align="right" class="title">
                                      <span>活动经费：</span>
                                    </td>
                                    <td class="t2">
                                    <input type="text" name="journeyLove.activityFee" id="activityFee"  value="${journeyLove.activityFee}"/>
                                    </td>
                                    <td align="right">
										<span>OA审批号<font color="red">(*)</font>：</span>
									</td>
									<td class="t2">
										<input type="text" name="journeyLove.oaSph" id="oaSph" value="${journeyLove.oaSph}"/>
									</td>
                                  </tr>
                               <tr>
                                       <td>
										<input type="hidden" name="journeyLove.id"
											value=${journeyLove.id } />
										<input type="hidden" name="journeyLove.createDate"
											value=${journeyLove.createDate } />
										</td>
							  </tr>
							   <tr>
                                    <td>
                                      <input type="hidden" name="journeyLove.subComName" id="subComName"/>
                                    </td>
                                    <td>
                                      <input type="hidden" name="journeyLove.subCityName" id="subCityName"/>
                                    </td>
                                  </tr>
							  <tr>
							     <td>
							       <input type="hidden" name="journeyLove.greenCardMember"
											id="greenCardMember" value="${journeyLove.greenCardMember}" />
								   <input type="hidden" name="journeyLove.silverCardMember"
											id="silverCardMember" value="${journeyLove.silverCardMember}" />
								   <input type="hidden" name="journeyLove.goldenCardMember"
											id="goldenCardMember" value="${journeyLove.goldenCardMember}" />
								  <input type="hidden" name="journeyLove.platinumCardMember"
											id="platinumCardMember"
											value="${journeyLove.platinumCardMember}" />
								  <input type="hidden" name="journeyLove.diamondCardMember"
											id="diamondCardMember"
											value="${journeyLove.diamondCardMember}" />
								  <input type="hidden" name="journeyLove.donateStuNum"
											id="donateStuNum" value="${journeyLove.donateStuNum}" />
							     </td>
							  </tr>
								</table>
							</div>
							<div class="btn">
								<input type="submit" value="保存" />
								<input type="button" value="返回"
									onclick="javascript :history.back(-1);" />
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>

	</body>
</html>
